package com.wj.tool.common.exception.message;

import org.apache.commons.lang3.StringUtils;

public class InterfaceMessage extends ApplicationMessage {
    public static final int ILLEGAL_SIGNATURE_CODE = 10101;
    public static final String ILLEGAL_SIGNATURE_10101_MESSAGE = " Illegal signature ";
    public static final int INVALID_PARAMETER_CODE = 10102;
    public static final String INVALID_PARAMETER_10102_MESSAGE = "Request params not valid ";
    public static final int RESUBMIT_CODE = 10103;
    public static final String RESUBMIT_10103_MESSAGE = " Resubmit data";

    public static InterfaceMessage illegalSignature(String message) {
        return new InterfaceMessage(10101, StringUtils.isEmpty(message) ? " Illegal signature " : message, MessageType.API);
    }

    public static InterfaceMessage invalidParameter(String message) {
        return new InterfaceMessage(10102, StringUtils.isEmpty(message) ? "Request params not valid " : message, MessageType.API);
    }

    public static InterfaceMessage resubmit(String message) {
        return new InterfaceMessage(10103, StringUtils.isEmpty(message) ? " Resubmit data" : message, MessageType.API);
    }

    private InterfaceMessage(int code, String message, MessageType type) {
        super(code, message, type);
    }
}